<style type="text/css">
    .label{
    	color: white;
        border-right-width: inherit;
        background: tan;
		background-color: black;
    }
	.linhaPar {
			padding:0px;
			margin:0px;
			background: #EEEEEE;
		}
    
    .table{
		border-color: black;
	
		
    }
</style>
<?php

class Application_Form_Comparar extends Zend_Form
{
// criar um checkBox
protected $cssLinhaPar = "linhaPar";
protected $colunasPorLinha = 10;
public function criarCheckBox($nome, $label="", $array, $css){
	$checkBox=$this->CreateElement('checkbox',$nome) 
                   ->setLabel($label);
                   
    $checkBox->setDecorators(array(
                   'ViewHelper',                   

                   'Description',

                   'Errors',    			      
					
    				array('Label'),
                 	array(array('data'=>'HtmlTag'), array('tag' => 'td', 'class'=>$css)),
                 	$array,
                 	//array(array('row'=>'HtmlTag'), array('tag' => 'tr', 'closeOnly'=>'true')),
                 					
              ));
     return $checkBox;
                   
}

protected $marcadores = null;

public function __construct($marcadores= "", $option=null)

   {

       
		$this->marcadores = $marcadores;
       parent::__construct($option);

  

       $this->setMethod('post');
		$linha = 0;
  		foreach($this->marcadores as $key => $marcador){  		
  			$css = "";  			
  			$array = array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'openOnly' => 'true', 'class'=>$css));
  			if($key > 0){
                $array = array(array('row' => 'HtmlTag'), array( 'class'=>$css));
            }
  			if($linha%2 == 0){
	  			$css = $this->cssLinhaPar;
	  		}
            if((($key+1)%$this->colunasPorLinha) == 0){
                $array = array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'closeOnly' => 'true'));
                $linha++;
                
            }
            
	  		
	  		
  			$cb = $this->criarCheckBox("marcador".$key, $marcador, $array, $css);
			
			$this->addElement($cb);
  		}
		
  		
       $submit=$this->CreateElement('submit','submit')
               

       
                       ->setLabel('Comparar');

  

       $submit->setDecorators(array(

  

               'ViewHelper',

               'Description',

               'Errors', array(array('data'=>'HtmlTag'), array('tag' => 'td',

               'colspan'=>$this->colunasPorLinha,'align'=>'center')),

               array(array('row'=>'HtmlTag'),array('tag'=>'tr'))

  

       ));

  

       $this->addElements(array(

  				

                   $submit,
               

  

       ));

  

       $this->setDecorators(array(

  

               'FormElements',

               array(array('data'=>'HtmlTag'),array('tag'=>'table', 'class'=>'table','border'=>'1', 'cellspacing'=>'0')), 
               
               'Form'

  

       ));



   }
	
    
}

